<%@page import="com.is.util.Common"%>
<%@page import="com.is.control.CourseClassControl"%>
<%@page import="com.is.model.CourseClass"%>
<%@page import="com.is.model.User"%>
<%@page import="com.is.control.StudentControl"%>
<%@page import="com.is.model.Student"%>
<%@page import="java.util.List"%>
<%@page import="com.is.control.ParamCourseControl"%>
<%@page import="com.is.util.ParamUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.is.control.ParamClassControl"%>
<%@page import="com.is.control.ParamStuyearControl"%>
<%@page import="com.is.util.DesData"%>
<%@page import="com.is.servlet.TokenProcessor"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/InterStu/resources/image/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../../resources/css/all.css" />
<link href="../../resources/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.artDialog.js"></script>
<script type="text/javascript" src="../../resources/js/iframeTools.js"></script>

<script type="text/javascript">
	$(function(){
		var block = $("#magic_block");
		if($(".active a").position()){
			block.css("top",$(".active a").position().top+10)
			.data("oriTop",$(".active a").position().top)
		}
		$(".nav ul li").find("a").hover(
			function(){
				var $this = $(this);
				var newTop = $this.position().top;
				block.stop().animate({
					top:newTop+10
				})
			},
			function(){
				block.stop().animate({
					top:block.data("oriTop")+10
				})
			}
		)
		var h = $(".right").height();
		$(".left").height(h);
		$(".update").click(function(){
			$.dialog.open("/InterStu/update_info.jsp",{width:460,height:400,title:"个人信息"});
		})
		$('img').error(function(){
			this.src = "/InterStu/resources/image/man.GIF";
		})
	})
	
	
	
	function doSubmit(){
      var submit = document.getElementById("submit");
      submit.disabled="disabled";
      return true;
}
      $(function(){
			$("input[name='add']").click(function(){
					document.forms['as'].action="dictation_add.jsp";
					document.forms['as'].submit();
			})
			$("input[name='show']").click(function(){
					document.forms['as'].action="dictation_statistics.jsp";
					document.forms['as'].submit();
			})

       })
	
</script>
<title>留学生预科班</title>
</head>
<%
		//此页面需要的参数courseId
		User cu =(User)session.getAttribute("user"); 
        DesData des = new DesData();
		int stuyear=ParamStuyearControl.getCurrentStuyearId();  //此处需要改为自动获取当前学年
		//System.out.print("DDD"+stuyear+"ddd");
		int uid = cu.getRole().equals("1")?0:cu.getId();
		List<CourseClass> ccs = CourseClassControl.getAllCourseClassIdByUidAndStuyear(uid,stuyear);
		ccs = Common.sortCourseClassName(ccs);
		int courseClassId = Integer.parseInt(des.decrypt(ParamUtil.getString(request,"courseClassId","4d3d3f222d4c6e08")));
		
 %>
<body>
<div class="header">
	<div class="title pr">
    	<a href="javascript:void(0);"><span class="update pa">个人信息</span></a>
        <span class="logout pa"><a class="hide" href="/InterStu/login/logout.jsp">退出</a></span>
    </div>
</div>
<div class="main">
	<div class="left"> 
	     <div class="infomation">
			<div class="photo">
			<%
			String picUrl = cu.getPicUrl();
			if(session.getAttribute("picUrl")!=null){
			 picUrl = "/InterStu/User/UserHeadImage/"+(String)session.getAttribute("picUrl");
			}	
			System.out.print(picUrl);
			%>
				<img width='60' height="60" src = "<%=picUrl %>"   onerror="nofound()"  />
			</div>
			<div class="welcome">
				<%=cu.getName() %>,<br/>
				欢迎您使用！
			</div>
		</div>  	   	  	
    	<div class="nav">
        	<ul>	
        		<li class="pa" id="magic_block"></li>
            	<%if(cu!=null&&cu.getRole().equals("1")){ %>
                <li><a href="/InterStu/pages/stuyear/stuyear_start.jsp">新学期设置</a></li>
                <li><a href="/InterStu/pages/users/user_all.jsp">用户管理</a></li>
                <%} %>
                <li><a href="/InterStu/pages/students/student_add.jsp">学生管理</a></li>
                <li class="active"><a href="/InterStu/pages/dictation/dictation_add.jsp">学生考核</a></li>
                <%if(cu!=null&&cu.getRole().equals("1")){ %>
                <li><a href="/InterStu/pages/assess/teacher_assess.jsp">教职人员管理</a></li>
                <%} %>
            </ul>
        </div>
    </div>
    <div class="right">
    	<div class="r1">
    	<table class="dictations tab">
	    <tr>
	    	<td>
	    		<a class="current" href="/InterStu/pages/dictation/dictation_add.jsp">听写成绩</a>
			</td>
			<td>
				<a href="/InterStu/pages/homework/homework_add.jsp">作业成绩</a>			
			</td>
			<td>
				<a href="/InterStu/pages/courseScore/score_go.jsp">成绩录入</a>
			</td>
			 <%if(cu!=null&&cu.getRole().equals("1")){ %>
			<td>
				<a href="/InterStu/pages/evaluation/students_all.jsp">综合评价</a>
			</td>
			<%} %>
	    </tr>
	    </table>
	    	<form action="" name="as" method="post">
	    	<table class="table">
	    	<caption>请选择</caption>
	    		<tr>
	    			<td width="25%">课程班级</td>
	    			<td width="25%"><select name="courseClassId">
							<% 
					             for(CourseClass c:ccs){//可能一个任课老师有多个班级
					            	 %>
					            	 <option value="<%=des.encrypt(c.getId()+"") %>"  <%if(c.getId()==courseClassId) out.print("selected='selected'"); %>><%=ParamClassControl.getClassName(c.getClassId())%><%=ParamCourseControl.getCourseById(c.getCourseId()).getCourseName() %></option> 
					            	
					            	 <%
					             }
							%>
						</select>
					</td>
	    			<td width="25%"><input type="hidden" name="type"  value="1" /><input type="button" value="进入听写" name="add"/></td>
	    			<td width="25%"><input type="button" value="查看听写情况" name="show"/></td>
	    		</tr>
	    	</table>
			</form>
			</div>
			<%
	           if(courseClassId!=0&&CourseClassControl.getCourseClassById(courseClassId)!=null){
		           CourseClass nowc = CourseClassControl.getCourseClassById(courseClassId);
		           System.out.print(nowc.getId()+"RRRR");
			%>
			<div class="r2">
			<form action="dictation_add_do.jsp" method="post" onsubmit="return doSubmit()">
			<table class="table">
			<caption>
			您当前记录的是<%=ParamCourseControl.getCourseById(nowc.getCourseId()).getCourseName() %>(<%=ParamCourseControl.getCourseById(nowc.getCourseId()).getCourseNameEn() %>)听写情况
			</caption>
			<tr>
			<th>姓名</th>
			<th colspan='4'>评价</th>
			</tr>
			<%
			      List<Student> students = StudentControl.getAllStudentMulti("","","",String.valueOf(nowc.getClassId()),"","","","");
			      System.out.print("DDDDD"+students.size()+"DDDD");
	              int mark=0; 
				  for(Student s:students){
						   %>
						   <tr>
						   <td><%=s.getChineseName() %>(<%=s.getPassportName() %>)</td>
						   <td><input type="radio" value="A" name="level<%=mark%>"/>A </td>
					       <td><input type="radio" value="B" name="level<%=mark%>" checked/>B </td>
					       <td><input type="radio" value="C" name="level<%=mark%>"/>C </td>
					       <td><input type="radio" value="D" name="level<%=mark%>"/>D
						   <input type="hidden" value="<%=s.getId() %>" name="student<%=mark %>"/></td>
						   </tr>
						   <%
						   mark++;
			}
			 %>
			<tr>
			<td colspan='1'>听写内容<input type="text" name="content"/></td>
			<td colspan='4'>
				<input type="hidden" value="<%=students.size()%>" name="size"/>
				<input type="hidden" value="<%=nowc.getClassId()%>" name="classId"/>
				<input type="hidden" value="<%=nowc.getCourseId()%>" name="courseId"/>
				<input type="hidden" value="<%=nowc.getId() %>" name="ccid" />
				<input type="hidden" name="token" value="<%=TokenProcessor.generateToken(request,response)%>"/>
				<input type="submit" value="提交"/>
			</td>
			</tr>
			</table>
			</form>
        </div>
        <a class='button' href="dictation_statistics.jsp?classId=<%=des.encrypt(String.valueOf(nowc.getClassId()))%>&&courseId=<%=des.encrypt(String.valueOf(nowc.getCourseId()))%>">查看本学期听写情况</a>
    <%
			
			}else{
				out.print("<div align='center'>请先选择录入听写成绩的课程</div>");
			} %>
    </div>
</div>
<div class="footer">
	<p>版权所有：东北师范大学留学生预科部&nbsp;&nbsp;  蓝旭工作室开发</p>
</div>
</body>
</html>
